package com.nbicc.file.service;

import com.nbicc.file.bo.FileDesc;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public interface IFileService {

    /**
     * 文件上传
     * @param fileDesc
     * @param input
     * @throws IOException
     */
    void uploadFile(FileDesc fileDesc, InputStream input) throws IOException;

    /**
     * 文件下载
     * @param fileDesc
     * @param output
     * @throws IOException
     */
    void downloadFile(FileDesc fileDesc, OutputStream output) throws IOException;

    /**
     * 文件删除
     * @param id
     * @throws IOException
     */
    void deleteFile(Number id) throws IOException;

    /**
     * 生成下载文件所需的文件描述
     * 与用户上传的参数结合
     * @param id
     * @param request
     * @return
     */
    FileDesc queryDownloadFileDesc(long id , HttpServletRequest request);

    /**
     * 生成上传文件所需的文件描述
     * @param request
     * @param uploadFile
     * @return
     */
    FileDesc queryUploadFileDesc(HttpServletRequest request , MultipartFile uploadFile);
}
